<?php
class NewsView
{
    public function RSSNews($newsXml)
    {
        $xhtml = "";
        $xhtml .= "<section id = 'news'>\n\t";
        $xhtml .= " <header>\n\t";
        $xhtml .= "     <h1>Alla nyheter</h1>\n\t";
        $xhtml .= " </header>\n\t";
        
        foreach($newsXml->channel->item as $i)
        {
            $xhtml .= " <article class = 'news'>\n\t";
            $xhtml .= "<header>
 		      	<hgroup>
 			        <h1>".$i->title."</h1>
 		        </hgroup>
 		          <p class='pubdate'><time datetime='".substr($i->pubDate,0,22)."' pubdate>".substr($i->pubDate,0,22)."</time>
 		          </p>     
 		      </header>
 		      <p class='desc'>".$i->description."</p>";
            $xhtml .= "<p class='pubdate'>källa: <a href='".$i->guid."'>".$i->guid."</a></p>";

            $xhtml .= " </article>\n\t";

        }
        
        $xhtml .= "</section>\n\t";
        return $xhtml;
    }
}
 
 